<?php
/**
 * GKPHP - 极客框架
 * 框架初始化
 */
namespace GK;
class CoreInit
{
    //框架初始化操作启动
    public static function Register(){
        //伪静态初始化
        if(!is_file(PUBLIC_PATH.'.htaccess')){
            self::Rewrite();
        }
    }
    /**
     * 伪静态初始化
     */
    public static function Rewrite(){
        $Rewrite=$_SERVER["SERVER_SOFTWARE"];
        $Htaccess=fopen(PUBLIC_PATH.'.htaccess', "w");
        if(strpos($Rewrite,'Apache')!== false){
            $Rewrite='Apache';
        }elseif(strpos($Rewrite,'Nginx')!== false){
            $Rewrite='Nginx';
        }else{
            $Rewrite='IIS';
        }
        fwrite($Htaccess,file_get_contents(GK_PATH.'Config'.DS.'Rewrite'.DS.$Rewrite.'.htaccess'));
    }
}